<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Guava集合工具：提升Java开发体验的神器</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', sans-serif;
            color: #333;
            line-height: 1.6;
            background-color: #f8fafc;
        }
        h1, h2, h3, h4, h5 {
            font-family: 'Noto Serif SC', serif;
            font-weight: 600;
            color: #1e293b;
        }
        .hero-gradient {
            background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
        }
        .code-block {
            background-color: #2d3748;
            color: #e2e8f0;
            border-radius: 0.5rem;
            overflow-x: auto;
        }
        .feature-card {
            transition: all 0.3s ease;
            border-radius: 0.5rem;
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
        }
        .feature-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
        }
        .mermaid {
            background-color: white;
            border-radius: 0.5rem;
            padding: 1.5rem;
            box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
        }
        .highlight {
            background-color: #e6f7ff;
            padding: 0.2rem 0.5rem;
            border-radius: 0.25rem;
            font-weight: 500;
            color: #0369a1;
        }
    </style>
</head>
<body class="antialiased">
    <!-- Hero Section -->
    <div class="hero-gradient text-white py-20 px-4 sm:px-6 lg:px-8">
        <div class="max-w-4xl mx-auto text-center">
            <div class="flex justify-center mb-6">
                <span class="inline-flex items-center px-4 py-2 rounded-full text-sm font-medium bg-white bg-opacity-20 backdrop-blur-sm">
                    <i class="fas fa-code mr-2"></i> Java开发工具
                </span>
            </div>
            <h1 class="text-4xl md:text-5xl font-bold mb-6 leading-tight">Guava集合工具：提升Java开发体验的神器</h1>
            <p class="text-xl md:text-2xl opacity-90 mb-8 max-w-3xl mx-auto">
                Google工程师精心设计的集合扩展库，让你的代码更简洁、高效且优雅
            </p>
            <div class="flex flex-wrap justify-center gap-4">
                <a href="#immutable-collection" class="px-6 py-3 bg-white text-indigo-600 font-medium rounded-lg hover:bg-opacity-90 transition duration-300">
                    <i class="fas fa-lock mr-2"></i>不可变集合
                </a>
                <a href="#multimap-bimap" class="px-6 py-3 bg-white bg-opacity-10 text-white font-medium rounded-lg hover:bg-opacity-20 transition duration-300">
                    <i class="fas fa-project-diagram mr-2"></i>高级映射
                </a>
                <a href="#collections-utils" class="px-6 py-3 bg-white bg-opacity-10 text-white font-medium rounded-lg hover:bg-opacity-20 transition duration-300">
                    <i class="fas fa-tools mr-2"></i>集合工具
                </a>
            </div>
        </div>
    </div>

    <!-- Main Content -->
    <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
        <!-- Introduction -->
        <div class="prose prose-lg max-w-none mb-16">
            <p class="text-lg text-gray-700">
                Java标准库中的集合框架(<span class="highlight">java.util.*</span>)提供了基础的数据结构实现，但在实际开发中，我们经常会遇到一些标准集合无法优雅解决的问题。<span class="highlight">Guava</span>提供了一系列强大的集合增强功能，填补了这些空白。
            </p>
            <blockquote class="border-l-4 border-indigo-500 pl-4 italic text-gray-700">
                <p>Java标准库里的集合类已经够用了，但你用过Guava的集合工具后就再也回不去了。Google工程师的良苦用心体现在每一个API设计上，用起来简直爽到飞起。</p>
            </blockquote>
        </div>

        <!-- Immutable Collection -->
        <section id="immutable-collection" class="mb-20">
            <div class="flex items-center mb-8">
                <div class="flex-shrink-0 h-12 w-12 rounded-full bg-indigo-100 flex items-center justify-center">
                    <i class="fas fa-lock text-indigo-600 text-xl"></i>
                </div>
                <h2 class="ml-4 text-3xl font-bold">1. ImmutableCollection不可变集合的实现原理</h2>
            </div>

            <div class="grid md:grid-cols-2 gap-8 mb-12">
                <div class="prose max-w-none">
                    <h3 class="text-2xl font-semibold mb-4">1.1 为什么需要不可变集合？</h3>
                    <p>在日常开发中，经常看到开发者写出这样的代码：</p>
                    <div class="code-block p-4 my-4">
                        <pre><code class="language-java">public static final List&lt;String&gt; CONSTANT_LIST = new ArrayList&lt;&gt;();
static {
    CONSTANT_LIST.add("item1");
    CONSTANT_LIST.add("item2");
    // ...
}</code></pre>
                    </div>
                    <p>看出问题了吗？虽然引用是final的，但集合内容却可以被修改！这会导致一些难以调试的并发问题。</p>
                    <p>Guava的不可变集合就是为了解决这个问题而设计的。它有以下几个关键优势：</p>
                    <ul>
                        <li><strong>线程安全</strong>：不需要同步</li>
                        <li><strong>内存效率</strong>：通常比可变集合更节省内存</li>
                        <li><strong>可被安全地用作常量</strong>：不会被意外修改</li>
                        <li><strong>可作为不可信代码的安全返回值</strong>：返回内部数据的安全视图</li>
                    </ul>
                </div>
                
                <div class="feature-card p-6 bg-white">
                    <h3 class="text-xl font-semibold mb-4 flex items-center">
                        <i class="fas fa-sitemap text-indigo-500 mr-2"></i> 不可变集合家族
                    </h3>
                    <div class="mermaid">
                        graph TD
                            A[ImmutableCollection] --> B[ImmutableList]
                            A --> C[ImmutableSet]
                            A --> D[ImmutableMultiset]
                            B --> E[RegularImmutableList]
                            B --> F[SingletonImmutableList]
                            C --> G[RegularImmutableSet]
                            C --> H[SingletonImmutableSet]
                    </div>
                    <p class="mt-4 text-sm text-gray-600">Guava针对不同大小的集合提供了优化实现，包括空集合、单元素集合和多元素集合。</p>
                </div>
            </div>

            <div class="prose max-w-none mb-8">
                <h3 class="text-2xl font-semibold mb-4">1.2 不可变集合的核心设计</h3>
                <p>Guava的不可变集合家族包括：</p>
                <div class="grid grid-cols-2 md:grid-cols-3 gap-4 my-4">
                    <div class="bg-indigo-50 p-3 rounded-lg">
                        <i class="fas fa-list-ol text-indigo-500 mr-2"></i> ImmutableList
                    </div>
                    <div class="bg-indigo-50 p-3 rounded-lg">
                        <i class="fas fa-list-ul text-indigo-500 mr-2"></i> ImmutableSet
                    </div>
                    <div class="bg-indigo-50 p-3 rounded-lg">
                        <i class="fas fa-map text-indigo-500 mr-2"></i> ImmutableMap
                    </div>
                    <div class="bg-indigo-50 p-3 rounded-lg">
                        <i class="fas fa-layer-group text-indigo-500 mr-2"></i> ImmutableMultimap
                    </div>
                    <div class="bg-indigo-50 p-3 rounded-lg">
                        <i class="fas fa-sort-amount-up text-indigo-500 mr-2"></i> ImmutableSortedSet
                    </div>
                    <div class="bg-indigo-50 p-3 rounded-lg">
                        <i class="fas fa-sort-amount-down text-indigo-500 mr-2"></i> ImmutableSortedMap
                    </div>
                </div>
            </div>

            <div class="grid md:grid-cols-2 gap-8 mb-8">
                <div class="prose max-w-none">
                    <h4 class="text-xl font-semibold mb-3">构建方式一：of方法</h4>
                    <div class="code-block p-4 my-4">
                        <pre><code class="language-java">// 使用of方法创建
ImmutableList&lt;String&gt; list = ImmutableList.of("a", "b", "c");
ImmutableSet&lt;Integer&gt; set = ImmutableSet.of(1, 2, 3);
ImmutableMap&lt;String, Integer&gt; map = 
    ImmutableMap.of("a", 1, "b", 2);</code></pre>
                    </div>
                </div>
                <div class="prose max-w-none">
                    <h4 class="text-xl font-semibold mb-3">构建方式二：builder</h4>
                    <div class="code-block p-4 my-4">
                        <pre><code class="language-java">// 使用builder创建
ImmutableList&lt;String&gt; list = ImmutableList.&lt;String&gt;builder()
    .add("a")
    .add("b", "c")
    .addAll(Arrays.asList("d", "e"))
    .build();</code></pre>
                    </div>
                </div>
            </div>

            <div class="prose max-w-none mb-8">
                <h3 class="text-2xl font-semibold mb-4">1.3 性能优势</h3>
                <div class="bg-white p-6 rounded-xl shadow-sm mb-6">
                    <div class="flex items-center mb-4">
                        <i class="fas fa-chart-line text-indigo-500 text-xl mr-2"></i>
                        <h4 class="text-lg font-semibold">不可变集合 vs 可变集合性能对比</h4>
                    </div>
                    <table class="min-w-full divide-y divide-gray-200">
                        <thead class="bg-gray-50">
                            <tr>
                                <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">集合类型</th>
                                <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">空集合内存</th>
                                <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">单元素内存</th>
                                <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">查询性能</th>
                            </tr>
                        </thead>
                        <tbody class="bg-white divide-y divide-gray-200">
                            <tr>
                                <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">ArrayList</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">24字节</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">32字节+元素</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">基准</td>
                            </tr>
                            <tr>
                                <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">ImmutableList</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">单例(0字节)</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">~16字节</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">快约15%</td>
                            </tr>
                        </tbody>
                    </table>
                </div>
                
                <blockquote class="border-l-4 border-indigo-500 bg-indigo-50 pl-4 py-2 my-4 rounded-r">
                    <p class="italic">"在一次大型电商系统重构中，将关键配置数据从ConcurrentHashMap改为ImmutableMap后，内存使用减少了约25%，查询性能提升了约15%。"</p>
                </blockquote>
            </div>
        </section>

        <!-- MultiMap/BiMap -->
        <section id="multimap-bimap" class="mb-20">
            <div class="flex items-center mb-8">
                <div class="flex-shrink-0 h-12 w-12 rounded-full bg-purple-100 flex items-center justify-center">
                    <i class="fas fa-project-diagram text-purple-600 text-xl"></i>
                </div>
                <h2 class="ml-4 text-3xl font-bold">2. MultiMap/BiMap等特殊集合的内部结构</h2>
            </div>

            <div class="grid md:grid-cols-2 gap-8 mb-12">
                <div class="prose max-w-none">
                    <h3 class="text-2xl font-semibold mb-4">2.1 MultiMap：一键多值的映射</h3>
                    <p>在实际开发中，我们经常需要处理一键多值的场景，比如：</p>
                    <ul>
                        <li>一个作者对应多本书</li>
                        <li>一个分类包含多个产品</li>
                        <li>一个用户有多个角色</li>
                    </ul>
                    <p>传统做法是使用<code>Map&lt;K, List&lt;V&gt;&gt;</code>或<code>Map&lt;K, Set&lt;V&gt;&gt;</code>，但这需要手动处理很多细节。Guava的MultiMap简化了这一过程。</p>
                    
                    <h4 class="text-xl font-semibold mt-6 mb-3">使用示例</h4>
                    <div class="code-block p-4 my-4">
                        <pre><code class="language-java">// 创建MultiMap
ListMultimap&lt;String, String&gt; multimap = ArrayListMultimap.create();

// 添加键值对
multimap.put("水果", "苹果");
multimap.put("水果", "香蕉");
multimap.put("蔬菜", "胡萝卜");

// 获取"水果"对应的所有值
Collection&lt;String&gt; fruits = multimap.get("水果"); // [苹果, 香蕉]

// 转换为传统Map视图
Map&lt;String, Collection&lt;String&gt;&gt; map = multimap.asMap();</code></pre>
                    </div>
                </div>
                
                <div class="feature-card p-6 bg-white">
                    <h3 class="text-xl font-semibold mb-4 flex items-center">
                        <i class="fas fa-code-branch text-purple-500 mr-2"></i> MultiMap类型
                    </h3>
                    <div class="mermaid">
                        graph LR
                            A[Multimap] --> B[ListMultimap]
                            A --> C[SetMultimap]
                            B --> D[ArrayListMultimap]
                            B --> E[LinkedListMultimap]
                            C --> F[HashMultimap]
                            C --> G[TreeMultimap]
                            C --> H[LinkedHashMultimap]
                    </div>
                    <div class="mt-4">
                        <h4 class="font-medium mb-2">实现特点：</h4>
                        <ul class="text-sm space-y-2">
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-purple-500 mt-1 mr-2 flex-shrink-0"></i>
                                <span>ListMultimap: 键对应的值保持插入顺序</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-purple-500 mt-1 mr-2 flex-shrink-0"></i>
                                <span>SetMultimap: 键对应的值不重复</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-purple-500 mt-1 mr-2 flex-shrink-0"></i>
                                <span>TreeMultimap: 键和值都按自然顺序排序</span>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>

            <div class="grid md:grid-cols-2 gap-8">
                <div class="feature-card p-6 bg-white">
                    <h3 class="text-2xl font-semibold mb-4 flex items-center">
                        <i class="fas fa-exchange-alt text-purple-500 mr-2"></i> 2.2 BiMap：双向映射
                    </h3>
                    <p>BiMap解决的是双向查找的问题。例如，当我们需要根据ID查找用户名，也需要根据用户名查找ID时，传统做法是维护两个Map。BiMap允许我们在一个数据结构中同时完成这两项任务。</p>
                    
                    <div class="code-block p-4 my-4">
                        <pre><code class="language-java">// 创建BiMap
BiMap&lt;Long, String&gt; userIdToName = HashBiMap.create();

// 添加映射
userIdToName.put(1L, "张三");
userIdToName.put(2L, "李四");

// 正向查找: ID -> 名字
String name = userIdToName.get(1L); // "张三"

// 反向查找: 名字 -> ID
Long id = userIdToName.inverse().get("张三"); // 1L</code></pre>
                    </div>
                </div>
                
                <div class="prose max-w-none">
                    <h4 class="text-xl font-semibold mb-3">BiMap实现原理</h4>
                    <p>BiMap的巧妙之处在于自动维护值到键的反向映射，保证键和值都是唯一的。</p>
                    <div class="mermaid my-4">
                        graph LR
                            A[BiMap接口] --> B[HashBiMap]
                            A --> C[ImmutableBiMap]
                            B --> D[内部维护两个Map]
                            D --> E[Map&lt;K,V&gt;]
                            D --> F[Map&lt;V,K&gt;]
                    </div>
                    
                    <div class="bg-purple-50 p-4 rounded-lg mt-4">
                        <h4 class="font-semibold mb-2 text-purple-800">实际案例：</h4>
                        <p>在一个认证系统中，使用BiMap管理令牌和用户ID的映射关系，这让代码变得异常简洁，也减少了维护两个Map的数据一致性问题。</p>
                    </div>
                </div>
            </div>
        </section>

        <!-- Collections Utils -->
        <section id="collections-utils" class="mb-20">
            <div class="flex items-center mb-8">
                <div class="flex-shrink-0 h-12 w-12 rounded-full bg-teal-100 flex items-center justify-center">
                    <i class="fas fa-tools text-teal-600 text-xl"></i>
                </div>
                <h2 class="ml-4 text-3xl font-bold">3. Collections2/Iterables工具类的高效实现</h2>
            </div>

            <div class="grid md:grid-cols-2 gap-8 mb-12">
                <div class="prose max-w-none">
                    <h3 class="text-2xl font-semibold mb-4">3.1 集合变换的优雅实现</h3>
                    <p>Java 8之前，对集合进行转换、过滤等操作通常需要手动遍历。Guava的Collections2提供了函数式编程风格的解决方案：</p>
                    
                    <div class="code-block p-4 my-4">
                        <pre><code class="language-java">// 过滤集合
Collection&lt;String&gt; nonEmptyStrings = Collections2.filter(
    strings, s -> !s.isEmpty());
    
// 转换集合
Collection&lt;Integer&gt; lengths = Collections2.transform(
    strings, String::length);</code></pre>
                    </div>
                    
                    <h4 class="text-xl font-semibold mt-6 mb-3">设计特点：</h4>
                    <ul>
                        <li><strong>惰性计算</strong>：不会立即创建新的集合，而是在需要时动态计算，节省内存</li>
                        <li><strong>代理模式</strong>：原始集合的任何更改都会反映在视图中</li>
                        <li><strong>装饰器模式</strong>：对集合功能进行增强而不修改原有结构</li>
                    </ul>
                </div>
                
                <div class="feature-card p-6 bg-white">
                    <h3 class="text-xl font-semibold mb-4 flex items-center">
                        <i class="fas fa-random text-teal-500 mr-2"></i> Iterables工具类
                    </h3>
                    <p>Iterables类提供了一系列用于操作Iterable对象的工具方法，它是Collections2的加强版，因为它可以处理任何实现了Iterable接口的对象。</p>
                    
                    <div class="mt-4 space-y-3">
                        <div class="flex items-start">
                            <div class="flex-shrink-0 h-10 w-10 rounded-full bg-teal-100 flex items-center justify-center mt-1 mr-3">
                                <i class="fas fa-angle-double-right text-teal-600"></i>
                            </div>
                            <div>
                                <h4 class="font-medium">获取唯一元素</h4>
                                <div class="code-block p-2 my-1 text-sm">
                                    <code>String only = Iterables.getOnlyElement(singletonList);</code>
                                </div>
                            </div>
                        </div>
                        
                        <div class="flex items-start">
                            <div class="flex-shrink-0 h-10 w-10 rounded-full bg-teal-100 flex items-center justify-center mt-1 mr-3">
                                <i class="fas fa-th-large text-teal-600"></i>
                            </div>
                            <div>
                                <h4 class="font-medium">分区处理</h4>
                                <div class="code-block p-2 my-1 text-sm">
                                    <code>Iterable&lt;List&lt;String&gt;&gt; partitions = Iterables.partition(strings, 10);</code>
                                </div>
                            </div>
                        </div>
                        
                        <div class="flex items-start">
                            <div class="flex-shrink-0 h-10 w-10 rounded-full bg-teal-100 flex items-center justify-center mt-1 mr-3">
                                <i class="fas fa-filter text-teal-600"></i>
                            </div>
                            <div>
                                <h4 class="font-medium">限制大小</h4>
                                <div class="code-block p-2 my-1 text-sm">
                                    <code>Iterable&lt;String&gt; limited = Iterables.limit(strings, 5);</code>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="prose max-w-none">
                <h3 class="text-2xl font-semibold mb-6">4. 重构案例：权限管理系统</h3>
                
                <div class="grid md:grid-cols-2 gap-8">
                    <div>
                        <h4 class="text-xl font-semibold mb-3 text-red-600">原始实现</h4>
                        <div class="code-block p-4 text-sm">
                            <pre><code class="language-java">// 原始代码
Map&lt;String, List&lt;String&gt;&gt; userPermissions = new HashMap&lt;&gt;();
Map&lt;String, String&gt; permissionToUser = new HashMap&lt;&gt;();

public void addPermission(String userId, String permission) {
    // 检查权限是否已分配给其他用户
    if (permissionToUser.containsKey(permission)) {
        String currentUser = permissionToUser.get(permission);
        if (!currentUser.equals(userId)) {
            throw new IllegalStateException("权限已分配给用户: " + currentUser);
        }
    }
    
    // 更新第一个Map
    List&lt;String&gt; permissions = userPermissions.get(userId);
    if (permissions == null) {
        permissions = new ArrayList&lt;&gt;();
        userPermissions.put(userId, permissions);
    }
    if (!permissions.contains(permission)) {
        permissions.add(permission);
    }
    
    // 更新第二个Map
    permissionToUser.put(permission, userId);
}</code></pre>
                        </div>
                        <div class="mt-2 text-sm text-gray-600">
                            <i class="fas fa-exclamation-triangle text-red-500 mr-1"></i> 200多行复杂代码，手动维护两个Map的一致性
                        </div>
                    </div>
                    
                    <div>
                        <h4 class="text-xl font-semibold mb-3 text-green-600">Guava重构后</h4>
                        <div class="code-block p-4 text-sm">
                            <pre><code class="language-java">// 使用Guava重构
private final BiMap&lt;String, String&gt; permissionToUser = HashBiMap.create();
private final Multimap&lt;String, String&gt; userPermissions = HashMultimap.create();

public void addPermission(String userId, String permission) {
    try {
        // BiMap确保权限唯一性
        permissionToUser.forcePut(permission, userId);
        // Multimap自动处理一对多关系
        userPermissions.put(userId, permission);
    } catch (Exception e) {
        // 回滚操作
        permissionToUser.remove(permission);
        userPermissions.remove(userId, permission);
        throw e;
    }
}</code></pre>
                        </div>
                        <div class="mt-2 text-sm text-gray-600">
                            <i class="fas fa-check-circle text-green-500 mr-1"></i> 50行简洁代码，自动维护双向映射一致性
                        </div>
                    </div>
                </div>
                
                <div class="bg-white p-6 rounded-xl shadow-sm mt-8">
                    <div class="grid md:grid-cols-3 gap-6">
                        <div class="text-center">
                            <div class="text-4xl font-bold text-teal-600 mb-2">60%</div>
                            <div class="text-sm text-gray-600">代码量减少</div>
                        </div>
                        <div class="text-center">
                            <div class="text-4xl font-bold text-teal-600 mb-2">0</div>
                            <div class="text-sm text-gray-600">手动空指针检查</div>
                        </div>
                        <div class="text-center">
                            <div class="text-4xl font-bold text-teal-600 mb-2">100%</div>
                            <div class="text-sm text-gray-600">数据一致性保证</div>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- Conclusion -->
        <section class="bg-white rounded-xl shadow-sm p-8 mb-12">
            <div class="text-center max-w-3xl mx-auto">
                <h2 class="text-3xl font-bold mb-6">Guava集合工具带来的变革</h2>
                <p class="text-lg text-gray-700 mb-8">
                    Guava的集合工具不仅仅是API的简单封装，它们代表了Google工程师对Java集合使用的深刻理解和最佳实践。通过提供不可变集合、高级映射结构和强大的工具类，Guava让我们的代码更简洁、更安全、更高效。
                </p>
                <div class="flex flex-wrap justify-center gap-4">
                    <div class="px-4 py-2 bg-indigo-100 text-indigo-800 rounded-full text-sm font-medium">
                        <i class="fas fa-code mr-1"></i> 更简洁的代码
                    </div>
                    <div class="px-4 py-2 bg-purple-100 text-purple-800 rounded-full text-sm font-medium">
                        <i class="fas fa-shield-alt mr-1"></i> 更安全的设计
                    </div>
                    <div class="px-4 py-2 bg-teal-100 text-teal-800 rounded-full text-sm font-medium">
                        <i class="fas fa-bolt mr-1"></i> 更高效的性能
                    </div>
                    <div class="px-4 py-2 bg-blue-100 text-blue-800 rounded-full text-sm font-medium">
                        <i class="fas fa-heart mr-1"></i> 更愉悦的开发体验
                    </div>
                </div>
            </div>
        </section>
    </div>

    <!-- Footer -->
    <footer class="bg-gray-900 text-white py-8">
        <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
            <div class="text-center">
                <h3 class="text-lg font-medium">技术小馆</h3>
                <p class="mt-2">
                    <a href="http://www.yuque.com/jtostring" class="text-indigo-300 hover:text-white transition duration-150">
                        http://www.yuque.com/jtostring
                    </a>
                </p>
            </div>
            <div class="mt-8 border-t border-gray-800 pt-8 flex justify-center">
                <p class="text-gray-400 text-sm">
                    &copy; 2023 技术小馆. 保留所有权利.
                </p>
            </div>
        </div>
    </footer>

    <script>
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: true,
                htmlLabels: true,
                curve: 'basis'
            }
        });
        
        // 平滑滚动
        document.querySelectorAll('a[href^="#"]').forEach(anchor => {
            anchor.addEventListener('click', function (e) {
                e.preventDefault();
                document.querySelector(this.getAttribute('href')).scrollIntoView({
                    behavior: 'smooth'
                });
            });
        });
    </script>
</body>
</html>